<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Props\HasDescription;
use JsonLowCode\Traits\Props\HasHugeSize;
use JsonLowCode\Traits\Props\HasShow;
use JsonLowCode\Traits\Props\HasSize;
use JsonLowCode\Traits\Props\HasTitle;
use JsonLowCode\Traits\Slots\HasSlotDescription;
use JsonLowCode\Traits\Slots\HasSlotFooter;
use JsonLowCode\Traits\Slots\HasSlotIcon;

/**
 * Spin组件
 * @method static Space make(mixed $children = null) Spin组件
 */
class Spin extends Schema
{
    protected string $componentName = "NSpin";

    use HasSize, HasShow, HasDescription;

    use HasSlotDescription, HasSlotIcon;

    public function __construct(mixed $children = null)
    {
        parent::__construct();
        $this->children($children);
    }

    /**
     * 设置组件大小尺寸
     * @param string|int $size  'small' | 'medium' | 'large' | number
     * @return $this
     */
    public function size(string|int $size = 'small' | 'medium' | 'large'): static
    {
        return $this->prop('size',$size);
    }

    /**
     * 自定义的加载图标是否有旋转动画
     * @param bool|string $bool
     * @return $this
     */
    public function rotate(bool|string $bool = true): static
    {
        return $this->prop('rotate', $bool);
    }

    /**
     * 设置组件Spin 的颜色
     * @param string $stroke
     * @return $this
     */
    public function stroke(string $stroke): static
    {
        return $this->prop('stroke',$stroke);
    }

    /**
     * Spin 边缘的相对宽度，假定 Spin 的外侧半径是 100
     * @param string|int $strokeWidth
     * @return $this
     */
    public function strokeWidth(string|int $strokeWidth): static
    {
        return $this->prop('strokeWidth',$strokeWidth);
    }
}
